/**  
 * @Project: CmsATDD
 * @Title: XmlParser.java
 * @Package fitnesse.util
 * @Description: Xml Serializer 
 * @author yanglei yanglei1@funshion.com
 * @date 2014年12月2日 下午12:10:37
 * @Copyright: 2014 funshion.com. All rights reserved.
 * @version V1.0  
*/
package util;

import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;

/**
 * @ClassName XMLSerializer
 * @Description Xml Serializer 
 * @author yanglei1 yanglei1@funshion.com
 * @date 2014年12月2日
 */
public class XMLSerializer {
	
	private Serializer serializer = new Persister();
	private String xmlString;
	
	/**
	 * Constructor 
	 * @param xmlString
	 */
	public XMLSerializer(String xmlString) {
		this.xmlString = xmlString;
	}
	
	/**
	 * Xml serialize to object
	 * @param clazz
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public Object xmlToObject(Class clazz) throws Exception {
		Object obj = serializer.read(clazz, this.xmlString);
		return obj;
	}
}
